home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGASIC / BASFILES.LZH / DIALOG3.BAS < prev    next >
BASIC Source File  |  1988-09-10  |  5KB  |  192 lines

  1. '$INCLUDE:'QBTOOLS.INC'
  2. '' '$INCLUDE: 'qbtools2.inc'
  3.  
  4. 'CLS
  5. 'DIM Ques$(20)
  6. '
  7. 'Ques$(1) = "This is a test to see how the"
  8. 'Ques$(2) = "dialog box works. The next line is the input."
  9. 'Ques$(3) = "It is important to see how this follows on from the"
  10. 'Ques$(4) = "input. Both these lines, and those before hand"
  11. 'Ques$(5) = "should be left justified."
  12. 'Ques$(6) = "Heres More"
  13. 'Ques$(7) = "Heres More again"
  14. 'Ques$(8) = "After"
  15. 'Ques$(9) = "Line 9"
  16. 'Ques$(10) = "Line 10"
  17. 'Ques$(11) = "Line 11"
  18. 'Ques$(12) = "Line 12"
  19. '
  20. 'First% = 2
  21. 'Second% = 3
  22. 'Third% = 3
  23. 'Fourth% = 4
  24. '
  25. 'sect% = 1
  26. '
  27. 'Ffgd% = 7
  28. 'Fbgd% = 0
  29. 'Gfgd% = 7
  30. 'Gbgd% = 0
  31. '
  32. 'Length1% = 22
  33. 'Length2% = 17
  34. 'Length3% = 47
  35. '
  36. 'FOR sect% = 0 TO 2
  37. '   TripleDialog Ques$(), First%, Second%, Third%, Fourth%, Length1%, Length2%, Length3%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Answer3$, Ek%
  38. 'NEXT sect%
  39. '
  40. 'END
  41.  
  42. SUB TripleDialog (Ques$(), First%, second%, Third%, Fourth%, Length1%, Length2%, Length3%, Ffgd%, Fbgd%, Gfgd%, Gbgd%, sect%, Answer1$, Answer2$, Answer3$, Ek%)
  43.  
  44.  
  45.     '  First    -  Textlines before the first question
  46.     '  Second   -  Textlines before the second question
  47.     '  Third    -  Textlines before the third question
  48.     '  Fourth   -  Textlines after the third question
  49.     '  Length1  -  Length of input #1
  50.     '  Length2  -  Length of input #2
  51.     '  Length3  -  Length of input #3
  52.     '  Ffgd     -  Frame foreground
  53.     '  Fbgd     -  Frame background
  54.     '  Gfgd     -  General Foreground
  55.     '  Gbgd     -  General background
  56.     '  Sect     -  Section of the screen to display on
  57.     '              0=Top,1=Center,2=Bottom
  58.     '  Answer1  -  Answer string #1
  59.     '  Answer2  -  Answer string #2
  60.     '  Answer3  -  Answer string #3
  61.     '  Ek       -  Exit Key
  62.     '              5=Return, 7=ESC
  63.     '$DYNAMIC
  64.  
  65.     REDIM Saver%(2000)
  66.  
  67.     BandA% = First% + second% + Third% + Fourth%
  68.  
  69.     height% = BandA%                    '  Pure Text height
  70.     height% = height% + 11               '  8 lines of drawing + 3 input lines
  71.  
  72.     IF height% > 25 THEN
  73.         EXIT SUB
  74.     END IF
  75.  
  76.     IF Length1% < 1 THEN
  77.         EXIT SUB
  78.     END IF
  79.  
  80.     IF Length2% < 1 THEN
  81.         EXIT SUB
  82.     END IF
  83.  
  84.     IF Length3% < 1 THEN
  85.         EXIT SUB
  86.     END IF
  87.  
  88.     SELECT CASE sect%
  89.         CASE 0
  90.             Begin% = 1
  91.         CASE 1
  92.             Begin% = (25 - height%) / 2
  93.         CASE 2
  94.             Begin% = (25 - height%) + 1
  95.         CASE ELSE
  96.             EXIT SUB
  97.     END SELECT
  98.  
  99.     SaveScreen Saver%(1)
  100.  
  101.     Txwd% = Length1%
  102.   
  103.     IF Length2% > Txwd% THEN
  104.         Txwd% = Length2%
  105.     END IF
  106.  
  107.     IF Length3% > Txwd% THEN
  108.         Txwd% = Length3%
  109.     END IF
  110.  
  111.  
  112.     FOR j% = 1 TO BandA%
  113.         Trim Ques$(j%)
  114.         IF LEN(Ques$(j%)) > Txwd% THEN
  115.             Txwd% = LEN(Ques$(j%))
  116.         END IF
  117.     NEXT j%
  118.  
  119.     BoxWidth% = Txwd% + 4
  120.     LeftCol% = (80 - BoxWidth%) / 2
  121.     Wid% = BoxWidth%
  122.     FrameType% = 3
  123.     FrmFgd% = Ffgd%
  124.     FrmBgd% = Fbgd%
  125.     Fill% = 1
  126.     FillFgd% = Gfgd%
  127.     FillBgd% = Gbgd%
  128.  
  129.     DrawBox Begin%, LeftCol%, Wid%, height%, FrameType%, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  130.  
  131.     Attrib1% = Attributes%(Gfgd%, Gbgd%, 0, 0)
  132.     Attrib2% = Attributes%(Ffgd%, Fbgd%, 0, 0)
  133.  
  134.     FOR j% = 1 TO First%
  135.         text$ = Ques$(j%)
  136.         ColorPrint text$, Begin% + j%, LeftCol% + 2, Attrib1%
  137.     NEXT j%
  138.  
  139.     FOR j% = 1 TO second%
  140.         text$ = Ques$(j% + First%)
  141.         ColorPrint text$, Begin% + First% + 3 + j%, LeftCol% + 2, Attrib1%
  142.     NEXT j%
  143.  
  144.     FOR j% = 1 TO Third%
  145.         text$ = Ques$(j% + First% + second%)
  146.         ColorPrint text$, Begin% + First% + second% + 6 + j%, LeftCol% + 2, Attrib1%
  147.     NEXT j%
  148.   
  149.     FOR j% = 1 TO Fourth%
  150.         text$ = Ques$(j% + First% + second% + Third%)
  151.         ColorPrint text$, Begin% + First% + second% + Third% + 9 + j%, LeftCol% + 2, Attrib1%
  152.     NEXT j%
  153.  
  154.     Istart1% = (80 - Length1%) / 2
  155.     Istart2% = (80 - Length2%) / 2
  156.     Istart3% = (80 - Length3%) / 2
  157.  
  158.     DrawBox Begin% + First% + 1, Istart1% - 1, Length1% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  159.     DrawBox Begin% + First% + second% + 4, Istart2% - 1, Length2% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  160.     DrawBox Begin% + First% + second% + Third% + 7, Istart3% - 1, Length3% + 2, 3, 1, FrmFgd%, FrmBgd%, Fill%, FillFgd%, FillBgd%
  161.  
  162.     DO
  163.  
  164.         Yc% = Begin% + First% + 2
  165.         TextInput 0, 0, 0, 0, 1, 1, 1, Length1%, Answer1$, Istart1%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  166.  
  167.         IF Ek% <> 6 THEN
  168.             EXIT DO
  169.         END IF
  170.  
  171.         Yc% = Begin% + First% + second% + 5
  172.         TextInput 0, 0, 0, 0, 1, 1, 1, Length2%, Answer2$, Istart2%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  173.       
  174.         IF Ek% <> 6 THEN
  175.             EXIT DO
  176.         END IF
  177.  
  178.         Yc% = Begin% + First% + second% + Third% + 8
  179.         TextInput 0, 0, 0, 0, 1, 1, 1, Length3%, Answer3$, Istart3%, Yc%, FrmFgd%, FrmBgd%, 0, Ek%
  180.       
  181.         IF Ek% <> 6 THEN
  182.             EXIT DO
  183.         END IF
  184.  
  185.  
  186.     LOOP
  187.  
  188.     RestoreScreen Saver%(1)
  189.  
  190. END SUB
  191.  
  192.